//
//  AmuseViewModel.swift
//  swiftDemo
//
//  Created by Gerry on 2022/1/10.
//

import UIKit

class AmuseViewModel: NSObject {

    var amuseList : [HotCateModel] = [HotCateModel]()
    
    func requestData( responseCallback : @escaping (_ : Bool, _ : String) -> Void ) {
        Network.baseRequest(type: .get, url: homeRoom, parameters: nil) { [self] result, isSuccess in
            if (isSuccess) {
                let datas = NSArray .yy_modelArray(with: HotCateModel.self, json: result ?? "")
                guard  let list = datas as? [HotCateModel] else {
                    responseCallback(false, "data is null")
                    return
                }
                
                self.amuseList = Array(list)
                responseCallback(true, "")
            } else {
                responseCallback(false, "err")
            }
        }
    }
}
